<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/7/4 0004
 * Time: 10:16
 */

namespace app\common\model\system;


use app\common\model\TimeModel;
use think\facade\Session;

class Word extends TimeModel
{
    /**
     * 读取后
     */
    public static function onAfterRead($data){
        $system_admin = app('app\common\model\system\SystemAdmin');
        $data->admin_id = $system_admin->where('id',$data->admin_id)->field('id,username')->find();
    }
    /**
     * 写入前
     */
    public static function onBeforeWrite($data){
        $data->admin_id = Session::get('admin.id');
    }
}